<template lang="html">
  <div>
    <el-container class="home-container">
      <el-main>
        <div class="wrapper-box">
          <div class="dis">
            <el-row :gutter="40">
              <el-col :xs="10" :md="10" :lg="10" class="list-item-box">
                <div class="receipt-nav-select">
                  <span>
                    <el-radio-group v-model="params.paperWidth" size="mini" :disabled="disabledEdit" @change="handleChange">
                      <el-radio-button label="2" >80mm</el-radio-button>
                      <el-radio-button label="1" >58mm</el-radio-button>
                    </el-radio-group>
                  </span>
                </div>
                <div class="receipt-nav" :style="paperWidth==='80mm'? 'width: 420px;':'width: 320px;'">
                  <div class="pos_r user-center-item">
                    <div class="receipt-info-title">
                      <div class="title-content">
                        <div class="title-name">{{params.printTemplateItem.mainHeading}}</div>
                      </div>
                      <div class="title-content-sub">
                        <div class="sub-title-name">{{params.printTemplateItem.subHeading}}</div>
                      </div>
                    </div>
                    <div class="receipt-info-header" v-show="params.printTemplateItem.showBareCode">
                      <div class="receipt-info">
                        <div class="dis al_item receipt-image-container">
                          <img class="receipt-image-shapecode" src="../../../assets/settingCenter/mallShopSetting/shapecode.png">
                        </div>
                      </div>
                    </div>
                    <div class="receipt-info-header">
                      <div class="receipt-info">
                        <div v-show="params.printTemplateItem.showShopName" class="dis al_item receipt-content-container">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-name">店铺名称：</span>
                            <span class="receipt-content-value">****精品小店</span>
                          </div>
                        </div>
                        <div v-show="params.printTemplateItem.showShopLocation" class="dis al_item receipt-content-container">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-name">店铺位置：</span>
                            <span class="receipt-content-value">B321</span>
                          </div>
                        </div>
                        <div v-show="params.printTemplateItem.showSquenceNo" class="dis al_item receipt-content-container">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-name">流水号：</span>
                            <span class="receipt-content-value">2C4RDGCG0FR805928</span>
                          </div>
                        </div>
                        <div v-show="params.printTemplateItem.showPrintTime" class="dis al_item receipt-content-container">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-name">打印时间：</span>
                            <span class="receipt-content-value">2022-01-17 12:30:23</span>
                          </div>
                        </div>
                        <div v-show="params.printTemplateItem.showDeliveryType" class="dis al_item receipt-content-container">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-name">配送方式：</span>
                            <span class="receipt-content-value">快递物流</span>
                          </div>
                        </div>
                        <div v-show="params.printTemplateItem.showDeliveryTime" class="dis al_item receipt-content-container">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-name">配送时间：</span>
                            <span class="receipt-content-value">2022-01-17</span>
                          </div>
                        </div>
                        <div v-show="params.printTemplateItem.showRecieverName" class="dis al_item receipt-content-container">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-name">收货人姓名：</span>
                            <span class="receipt-content-value">张三丰</span>
                          </div>
                        </div>
                        <div v-show="params.printTemplateItem.showRecieverPhone" class="dis al_item receipt-content-container">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-name">收货人电话：</span>
                            <span class="receipt-content-value">021-38892233</span>
                          </div>
                        </div>
                        <div v-show="params.printTemplateItem.showRecieverAddress" class="dis al_item receipt-content-container">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-name">收货地址：</span>
                            <span class="receipt-content-value">上海市闵行区***路**号**室</span>
                          </div>
                        </div>
                      </div>
                    </div>
                    <div class="receipt-info-divider">
                      <el-divider direction="horizontal" />
                    </div>
                    <div v-show="params.printTemplateItem.checkGoodsInfo" class="receipt-info-header">
                      <div class="receipt-content">
                        <span class="receipt-content-name"><b>商品名称:</b></span>
                      </div>
                      <div class="receipt-info">
                        <div class="dis al_item receipt-content-container">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-value"><b>单价</b></span>
                            <span class="receipt-content-value f2"><b>数量</b></span>
                            <span class="receipt-content-value f3"><b>金额</b></span>
                          </div>
                        </div>
                      </div>
                      <div class="receipt-content">
                        <span class="receipt-content-name">******商品名1</span>
                      </div>
                      <div class="receipt-info">
                        <div class="dis al_item receipt-content-container">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-value">12.34</span>
                            <span class="receipt-content-value f2">10</span>
                            <span class="receipt-content-value f3">123.40</span>
                          </div>
                        </div>
                      </div>
                      <div class="receipt-content">
                        <span class="receipt-content-name">******商品名2</span>
                      </div>
                      <div class="receipt-info">
                        <div class="dis al_item receipt-content-container">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-value">23.14</span>
                            <span class="receipt-content-value f2">20</span>
                            <span class="receipt-content-value f3">462.80</span>
                          </div>
                        </div>
                      </div>
                    </div>
                    <div v-show="params.printTemplateItem.showGoodsInfo" class="receipt-info-divider">
                      <el-divider direction="horizontal" />
                    </div>
                    <div v-show="params.printTemplateItem.showGoodsInfo"  class="receipt-info-header">
                      <div class="receipt-info">
                        <div class="dis al_item receipt-content-container">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-value">共2件</span>
                            <span class="receipt-content-value f3"><b>合计：</b> <b>￥586.20</b></span>
                          </div>
                        </div>
                      </div>
                    </div>
                    <div class="receipt-info-divider">
                      <el-divider direction="horizontal" />
                    </div>
                    <div class="receipt-info-header">
                      <div class="receipt-info">
                        <div class="dis al_item receipt-content-container"  v-show="params.printTemplateItem.showDeliveryFee" >
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-value">运费(+)</span>
                            <span class="receipt-content-value f3">￥6.20</span>
                          </div>
                        </div>
                        <div class="dis al_item receipt-content-container"  v-show="params.printTemplateItem.showPackageFee" >
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-value">打包费(+)</span>
                            <span class="receipt-content-value f3">￥10.00</span>
                          </div>
                        </div>

                        <div class="dis al_item receipt-content-container">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-value">税费(+)</span>
                            <span class="receipt-content-value f3">￥5.85</span>
                          </div>
                        </div>
                      </div>
                    </div>
                    <div class="receipt-info-divider">
                      <el-divider direction="horizontal" />
                    </div>
                    <div class="receipt-info-header">
                      <div class="receipt-info">
                        <div class="dis al_item receipt-content-container" >
                          <div class="flex_1 receipt-content">
                            <span  v-show="params.printTemplateItem.showDiscountSum || params.printTemplateItem.showDiscountDetail" class="receipt-content-value">优惠(-)</span>
                            <span  v-show="params.printTemplateItem.showDiscountDetail" class="receipt-content-value f3"><b>折扣优惠：</b>￥12.85</span>
                          </div>
                        </div>
                        <div class="dis al_item receipt-content-container"  v-show="params.printTemplateItem.showDiscountDetail">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-value f3"><b>优惠券：</b>￥50.00</span>
                          </div>
                        </div>
                        <div class="dis al_item receipt-content-container"  v-show="params.printTemplateItem.showDiscountDetail">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-value f3"><b>积分抵扣：</b>5.00</span>
                          </div>
                        </div>
                        <div class="dis al_item receipt-content-container"  v-show="params.printTemplateItem.showDiscountDetail">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-value f3"><b>整体优惠：</b>￥9.80</span>
                          </div>
                        </div>
                        <div class="dis al_item receipt-content-container"  v-show="params.printTemplateItem.showDiscountSum">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-value f3"><b>总计：</b><b>￥-77.65</b></span>
                          </div>
                        </div>
                      </div>
                    </div>
                    <div class="receipt-info-divider" >
                      <el-divider direction="horizontal" />
                    </div>
                    <div class="receipt-info-header">
                      <div class="receipt-info">
                        <div class="dis al_item receipt-content-container">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-value">支付方式：微信支付</span>
                          </div>
                        </div>
                        <div class="dis al_item receipt-content-container">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-value">实收：<b>￥530.60</b></span>
                          </div>
                        </div>
                        <div class="dis al_item receipt-content-container"  v-show="params.printTemplateItem.showPaySequnenceNo">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-value">第三方支付流水：32332513213251325132</span>
                          </div>
                        </div>
                      </div>
                    </div>
                    <div class="receipt-info-divider">
                      <el-divider direction="horizontal" />
                    </div>
                    <div class="receipt-info-header">
                      <div class="receipt-info">
                        <div class="dis al_item receipt-content-container"  v-show="params.printTemplateItem.showMemberBasicInfo">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-value">会员名称：王**</span>
                          </div>
                        </div>
                        <div class="dis al_item receipt-content-container" >
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-value">手机号码：+86 189****0666</span>
                          </div>
                        </div>
                        <div class="dis al_item receipt-content-container"  v-show="params.printTemplateItem.showMemberPointInfo">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-value">积分余额：5800</span>
                          </div>
                        </div>
                      </div>
                    </div>
                    <div class="receipt-info-divider">
                      <el-divider direction="horizontal" />
                    </div>
                    <div class="receipt-info-header">
                      <div class="receipt-info">
                        <div class="dis al_item receipt-content-container"  v-show="params.printTemplateItem.showOrderTime">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-value">下单时间：2021-12-20 12:40:23</span>
                          </div>
                        </div>
                        <div class="dis al_item receipt-content-container"  v-show="params.printTemplateItem.showPayTime">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-value">支付时间：2021-12-20 12:45:45</span>
                          </div>
                        </div>
                        <div class="dis al_item receipt-content-container"  v-show="params.printTemplateItem.showPayTerminal">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-value">操作渠道：收银POS</span>
                          </div>
                        </div>
                        <div class="dis al_item receipt-content-container"  v-show="params.printTemplateItem.showOperator">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-value">操作人员：李小路</span>
                          </div>
                        </div>
                        <div class="dis al_item receipt-content-container"  v-show="params.printTemplateItem.showGuider">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-value">导购人员：王杉杉</span>
                          </div>
                        </div>
                        <div class="dis al_item receipt-content-container"  v-show="params.printTemplateItem.showShopAddresss">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-value">地址：上海市闵行区吴中路189号</span>
                          </div>
                        </div>
                        <div class="dis al_item receipt-content-container"  v-show="params.printTemplateItem.showQuestionPhone">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-value">咨询电话：021-67899999</span>
                          </div>
                        </div>
                      </div>
                    </div>
                    <div class="receipt-info-footer">
                      <div class="receipt-info">
                        <div class="dis al_item receipt-content-container">
                          <div class="flex_1 receipt-content">
                            <img class="receipt-image-qrcode" src="../../../assets/settingCenter/mallShopSetting/appqrcode.png">
                            <img class="receipt-image-qrcode" src="../../../assets/settingCenter/mallShopSetting/mpqrcode.png">
                          </div>
                        </div>
                        <div class="dis al_item receipt-content-container">
                          <div class="flex_1 receipt-content">
                            <span class="receipt-content-value"><b>===={{ params.printTemplateItem.welcomeInfo }}====</b></span>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </el-col>
              <el-col :xs="14" :md="14" :lg="14" class="list-item-box">
                <!-- 右侧设置 -->
                <div class="flex_1">
                  <div class="user-center-config">
                    <div class="user-center-content">
                      <el-card shadow="never" class="cardInfo">
                        <el-form :model="params" ref="ruleForm" :rules="rules">
                        <div class="dis al_item">
                          <div class="nav-item">
                            <div class="item-content">
                                <el-form-item class="person-center-form-item" prop="templateName" label="模板名称：">
                                  <el-input v-model="params.templateName"  :disabled="disabledEdit" style="width: 320px;" size="mini" maxlength="15" show-word-limit />
                                </el-form-item>
                                <el-form-item class="person-center-form-item"  prop="remark"  label="备注信息：">
                                  <el-input v-model="params.remark"  :disabled="disabledEdit" type="textarea" controls-position="right" style="width: 320px;" size="mini" maxlength="10" show-word-limit />
                                </el-form-item>
                            </div>
                          </div>
                        </div>
                        <div class="dis al_item">
                          <div class="nav-item">
                            <div class="dis al_item dis_ju_spb item-header">
                              <div class="cursor flex_1 dis al_item">
                                <el-checkbox v-model="params.printTemplateItem.checkTitle" disabled label="小票标题信息"/>
                              </div>
                            </div>
                            <div class="item-content">
                                <el-form-item class="person-center-form-item"  prop="mainHeading"  label="主标题：">
                                  <el-input v-model="params.printTemplateItem.mainHeading" :disabled="disabledEdit" style="width: 300px;" size="mini" maxlength="15" show-word-limit />
                                </el-form-item>
                                <el-form-item class="person-center-form-item"  prop="subHeading"  label="副标题：">
                                  <el-input v-model="params.printTemplateItem.subHeading"  :disabled="disabledEdit" style="width: 300px;" size="mini" maxlength="10" show-word-limit />
                                </el-form-item>
                            </div>
                          </div>
                        </div>
                        <div class="dis al_item">
                          <div class="nav-item">
                            <div class="dis al_item dis_ju_spb item-header">
                              <div class="cursor flex_1 dis al_item">
                                <el-checkbox v-model="params.printTemplateItem.checkBarCode" :disabled="true"  label="条形码信息" />
                              </div>
                            </div>
                            <div class="item-content">

                                <el-form-item class="person-center-form-item">
                                  <el-checkbox v-model="params.printTemplateItem.showBareCode" :disabled="true"  label="显示条形码" />
                                </el-form-item>

                            </div>
                          </div>
                        </div>
                        <div class="dis al_item">
                          <div class="nav-item">
                            <div class="dis al_item dis_ju_spb item-header">
                              <div class="cursor flex_1 dis al_item">
                                <el-checkbox v-model="params.printTemplateItem.checkHeadInfo" :disabled="true"  label="头部信息" />
                              </div>
                            </div>
                            <div class="item-content">

                                <el-form-item class="person-center-form-item" >
                                  <el-checkbox v-model="params.printTemplateItem.showShopName" label="店铺名称"  :disabled="true" />
                                  <el-checkbox v-model="params.printTemplateItem.showShopLocation" label="店铺位置"  :disabled="true" />
                                  <el-checkbox v-model="params.printTemplateItem.showSquenceNo" label="流水号"  :disabled="true" />
                                  <el-checkbox v-model="params.printTemplateItem.showPrintTime" label="打印时间"  :disabled="true" />
                                  <el-checkbox v-model="params.printTemplateItem.showDeliveryType" label="配送方式"  :disabled="disabledEdit" />
                                  <el-checkbox v-model="params.printTemplateItem.showDeliveryTime" label="配送时间"  :disabled="disabledEdit" />
                                  <el-checkbox v-model="params.printTemplateItem.showRecieverName" label="收货人姓名"  :disabled="disabledEdit" />
                                  <el-checkbox v-model="params.printTemplateItem.showRecieverPhone" label="收货人电话"  :disabled="disabledEdit" />
                                  <el-checkbox v-model="params.printTemplateItem.showRecieverAddress" label="收货地址"  :disabled="disabledEdit" />
                                </el-form-item>

                            </div>
                          </div>
                        </div>
                        <div class="dis al_item">
                          <div class="nav-item">
                            <div class="dis al_item dis_ju_spb item-header">
                              <div class="cursor flex_1 dis al_item">
                                <el-checkbox v-model="params.printTemplateItem.checkGoodsInfo" label="商品信息" disabled/>
                              </div>
                            </div>
                            <div  class="item-content">

                                <el-form-item class="person-center-form-item">
                                  <el-checkbox v-model="params.printTemplateItem.showGoodsInfo" label="商品信息" disabled/>
                                </el-form-item>

                            </div>
                          </div>
                        </div>
                        <div class="dis al_item">
                          <div class="nav-item">
                            <div class="dis al_item dis_ju_spb item-header">
                              <div class="cursor flex_1 dis al_item">
                                <el-checkbox v-model="params.printTemplateItem.checkDeliverAndTaxFee" label="运费税费打包费" disabled />
                              </div>
                            </div>
                            <div class="item-content">

                                <el-form-item class="person-center-form-item">
                                  <el-checkbox v-model="params.printTemplateItem.showDeliveryFee" label="运费"  :disabled="disabledEdit" />
                                  <el-checkbox v-model="params.printTemplateItem.showTaxFee" label="税费" disabled />
                                  <el-checkbox v-model="params.printTemplateItem.showPackageFee" label="打包费"  :disabled="disabledEdit" />
                                </el-form-item>

                            </div>
                          </div>
                        </div>
                        <div class="dis al_item">
                          <div class="nav-item">
                            <div class="dis al_item dis_ju_spb item-header">
                              <div class="cursor flex_1 dis al_item">
                                <el-checkbox v-model="params.printTemplateItem.checkDiscountInfo" label="优惠信息" :disabled="disabledEdit" @change="changeDiscountInfo"/>
                              </div>
                            </div>
                            <div class="item-content">

                                <el-form-item class="person-center-form-item">
                                  <el-checkbox v-model="params.printTemplateItem.showDiscountDetail"  label="优惠明细" :checked="params.printTemplateItem.showDiscountDetail"  :disabled="disabledEdit" />
                                  <el-checkbox v-model="params.printTemplateItem.showDiscountSum"  label="优惠汇总" :checked="params.printTemplateItem.showDiscountSum"  :disabled="disabledEdit" />
                                </el-form-item>

                            </div>
                          </div>
                        </div>
                        <div class="dis al_item">
                          <div class="nav-item">
                            <div class="dis al_item dis_ju_spb item-header">
                              <div class="cursor flex_1 dis al_item">
                                <el-checkbox v-model="params.printTemplateItem.checkPaymentInfo" label="支付信息" disabled />
                              </div>
                            </div>
                            <div class="item-content">

                                <el-form-item class="person-center-form-item">
                                  <el-checkbox v-model="params.printTemplateItem.showPayType"  label="支付方式" :checked="true" :disabled="true" />
                                  <el-checkbox v-model="params.printTemplateItem.showPayAmount"  label="支付金额" :checked="true" :disabled="true" />
                                  <el-checkbox v-model="params.printTemplateItem.showPaySequnenceNo" label="第三方交易流水" :checked="true"  :disabled="disabledEdit" />
                                </el-form-item>

                            </div>
                          </div>
                        </div>
                        <div class="dis al_item">
                          <div class="nav-item">
                            <div class="dis al_item dis_ju_spb item-header">
                              <div class="cursor flex_1 dis al_item">
                                <el-checkbox v-model="params.printTemplateItem.checkMemberInfo" label="会员信息"  :disabled="disabledEdit" />
                              </div>
                            </div>
                            <div class="item-content">

                                <el-form-item class="person-center-form-item">
                                  <el-checkbox v-model="params.printTemplateItem.showMemberBasicInfo"  label="基本信息" :checked="true"  :disabled="disabledEdit" />
                                  <el-checkbox v-model="params.printTemplateItem.showMemberSensitiveInfo"  label="脱敏处理" :checked="true"  :disabled="disabledEdit" />
                                  <el-checkbox v-model="params.printTemplateItem.showMemberPointInfo"  label="会员积分" :checked="true"  :disabled="disabledEdit" />
                                </el-form-item>

                            </div>
                          </div>
                        </div>
                        <div class="dis al_item">
                          <div class="nav-item">
                            <div class="dis al_item dis_ju_spb item-header">
                              <div class="cursor flex_1 dis al_item">
                                <el-checkbox v-model="params.printTemplateItem.checkOtherInfo" label="其他信息"  :disabled="true" />
                              </div>
                            </div>
                            <div class="item-content">

                                <el-form-item class="person-center-form-item">
                                  <el-checkbox v-model="params.printTemplateItem.showOrderTime"  label="下单时间" :checked="true"  :disabled="true" />
                                  <el-checkbox v-model="params.printTemplateItem.showPayTime"  label="支付时间" :checked="true"  :disabled="true" />
                                  <el-checkbox v-model="params.printTemplateItem.showPayTerminal"  label="操作渠道" :checked="true"  :disabled="true" />
                                  <el-checkbox v-model="params.printTemplateItem.showOperator"  label="操作人员" :checked="true"  :disabled="true" />
                                  <el-checkbox v-model="params.printTemplateItem.showGuider"  label="导购人员" :checked="true"  :disabled="disabledEdit" />
                                  <el-checkbox v-model="params.printTemplateItem.showShopAddresss"  label="店铺地址" :checked="true"  :disabled="disabledEdit" />
                                  <el-checkbox v-model="params.printTemplateItem.showQuestionPhone"  label="咨询电话" :checked="true"  :disabled="disabledEdit" />
                                </el-form-item>

                            </div>
                          </div>
                        </div>
                        <div class="dis al_item">
                          <div class="nav-item">
                            <div class="dis al_item dis_ju_spb item-header">
                              <div class="cursor flex_1 dis al_item">
                                <el-checkbox v-model="params.printTemplateItem.checkPromotionInfo" label="推广信息"  :disabled="disabledEdit" />
                              </div>
                            </div>
                            <div class="item-content">

                                <el-form-item class="person-center-form-item">
                                  <el-checkbox v-model="params.printTemplateItem.showWechatMpBarCode"  label="关注公众号" :checked="true"  :disabled="disabledEdit" />
                                  <el-checkbox v-model="params.printTemplateItem.showRegisterBarCode"  label="注册二维码" :checked="true"  :disabled="disabledEdit" />
                                  <el-checkbox v-model="params.printTemplateItem.showInvoiceBarCode"  label="发票二维码" :checked="true"  :disabled="disabledEdit" />
                                  <el-checkbox v-model="params.printTemplateItem.showNoticeBarCode"  label="公告信息" :checked="true"  :disabled="disabledEdit" />
                                  <el-checkbox v-model="params.printTemplateItem.showMarkettingBarCode"  label="活动二维码" :checked="true"  :disabled="disabledEdit" />
                                </el-form-item>

                            </div>
                          </div>
                        </div>
                        <div class="dis al_item">
                          <div class="nav-item">
                            <div class="dis al_item dis_ju_spb item-header">
                              <div class="cursor flex_1 dis al_item">
                                <el-checkbox v-model="params.printTemplateItem.checkFooterInfo"  label="底部信息"  :disabled="true" />
                              </div>
                            </div>
                            <div class="item-content">

                                <el-form-item class="person-center-form-item">
                                  <el-input v-model="params.printTemplateItem.welcomeInfo"  :disabled="disabledEdit" controls-position="right" type="textarea" style="width: 400px;" size="mini" maxlength="15" show-word-limit />
                                </el-form-item>

                            </div>
                          </div>
                        </div>
                          </el-form>
                      </el-card>
                    </div>
                  </div>
                </div>
              </el-col>
            </el-row>
          </div>
        </div>
      </el-main>
      <div class="wrapper-save">
        <el-button size="mini" type="primary"  @click="cancelSubmit">取消</el-button>
        <el-button v-if="!disabledEdit" size="mini" type="primary"  @click="submit">保存</el-button>
      </div>
    </el-container>
  </div>
</template>

<script>
import { addPrintTemplate, modifyPrintTemplate, viewPrintTemplate } from '@/api/print'
export default {
  components: {
  },
  data() {
    return {
      disabledEdit: true,
      flag: true,
      paperWidth: '80mm',
      params:{
        templateId: '',
        templateName: '',
        paperWidth: 2,
        remark: '',
        printTemplateItem:{
          	/**
          	 * 小票标题开关
          	 */
          	 checkTitle: true,
          	 mainHeading: '', //主标题
          	 subHeading: '', //付标题
          	/**
          	 * 条形码开关
          	 */
          	 checkBarCode: true,
          	 showBareCode: true, //显示条形码
          	/**
          	 * 头部信息开关
          	 */
          	 checkHeadInfo: true,
          	 showShopName: true, //店铺名称
          	 showShopLocation: true, //店铺位置
          	 showSquenceNo: true, //流水号
          	 showPrintTime: true, //打印时间
          	 showDeliveryType: false, //配送方式
          	 showDeliveryTime: false, //配送时间
          	 showRecieverName: false, //收货人姓名
          	 showRecieverPhone: false, //收货人电话
          	 showRecieverAddress: false, //收货地址
          	/**
          	 * 商品信息开关
          	 */
          	 checkGoodsInfo: true,
          	 showGoodsInfo: true, //商品信息
          	/**
          	 * 运费税费打包费
          	 */
          	 checkDeliverAndTaxFee: true,
          	 showDeliveryFee: true, //运费
          	 showTaxFee: true, //税费
          	 showPackageFee: true, //打包费
          	/**
          	 * 优惠信息开关
          	 */
          	 checkDiscountInfo: true,
          	 showDiscountDetail: true, //优惠明细
          	 showDiscountSum: true, //优惠汇总
          	/**
          	 * 支付信息开关
          	 */
          	 checkPaymentInfo: true,
          	 showPayType: true, //支付方式
          	 showPayAmount: true, //支付金额
          	 showPaySequnenceNo: true, //第三方交易流水
          	/**
          	 * 会员信息开关
          	 */
          	 checkMemberInfo: true,
          	 showMemberBasicInfo: true, //基本信息
          	 showMemberSensitiveInfo: true, //脱敏处理
             showMemberPointInfo: true, //会员积分
          	/**
          	 * 其他信息开关
          	 */
          	 checkOtherInfo: true,
          	 showOrderTime: true, //下单时间
          	 showPayTime: true, //支付时间
          	 showPayTerminal: true, //操作渠道
          	 showOperator: true, //操作人员
          	 showGuider: true, //导购人员
          	 showShopAddresss: true, //店铺地址
          	 showQuestionPhone: true, //咨询电话
          	/**
          	 * 推广信息开关
          	 */
          	 checkPromotionInfo: true,
          	 showWechatMpBarCode: true, //关注公众号
          	 showRegisterBarCode: true, //注册二维码
          	 showInvoiceBarCode: true, //发票二维码
          	 showNoticeBarCode: true, //公告信息
          	 showMarkettingBarCode: true,  //活动二维码
          	/**
          	 * 底部信息开关
          	 */
          	 checkFooterInfo: true,
          	 welcomeInfo: '感谢您的惠顾，欢迎再次光临！' //底部信息
        }
      },
      rules: {}
    }
  },
  mounted() {
  },
  created() {
    this.templateId =  this.$route.query.id
    this.disabledEdit = this.$route.query.editDisabled
    this.loadPrintTemplateData()
  },
  methods: {
    handleChange(){
     if(this.params.paperWidth == 1){
       this.paperWidth = '58mm'
     }else{
       this.paperWidth = '80mm'
     }
    },
    changeDiscountInfo(val){
      if(val){
        this.param.printTemplateItem.showDiscountDetail = true
        this.param.printTemplateItem.showDiscountSum = true
      }else{
        this.param.printTemplateItem.showDiscountDetail = false
        this.param.printTemplateItem.showDiscountSum = false
      }
    },
    cancelSubmit(){
      this.$router.back()
    },
    loadPrintTemplateData(){
      if(this.templateId){
        this.flag = true
        viewPrintTemplate(this.templateId).then(res =>{
          console.log(JSON.stringify(res))
          if(res){
            if(res.code){
              this.$message.error(`${res.msg}`);
            }else{
              this.params = res
              this.handleChange()
            }
          }
        })
      }else{
        this.flag = false
      }
    },
    // 保存
    submit(){
      if(this.params.templateName == null || this.params.templateName == undefined || this.params.templateName === ''){
          alert("模板名称不能为空！")
          return false
      }
      if(this.params.printTemplateItem.mainHeading == null || this.params.printTemplateItem.mainHeading == undefined || this.params.printTemplateItem.mainHeading === ''){
          alert("小票主标题不能为空！")
          return false
      }
      if(this.params.printTemplateItem.subHeading == null || this.params.printTemplateItem.subHeading == undefined || this.params.printTemplateItem.subHeading === ''){
          alert("小票副标题不能为空！")
          return false
      }
      this.$confirm('确认要修改配置?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
       this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          if(this.flag){ // 编辑
            modifyPrintTemplate(this.params).then(res =>{
              if(res){
                if(res.code){
                  this.$message.error(`${res.msg}`);
                }else{
                  this.$message.success('修改成功！')
                  this.$router.back()
                }
              }
            })
          }else{ // 新增
            addPrintTemplate(this.params).then(res =>{
              if(res){
                if(res.code){
                  this.$message.error(`${res.msg}`);
                }else{
                  this.$message.success('添加成功！')
                  this.$router.back()
                }
              }
            })
          }
        }
       })
      })
    }
  }
}
</script>
<style lang="scss">
.home-container {
  background: #fff;
  margin: 4px 0 10px 0;
  border-radius: 3px;
  height: 650px;
  overflow-y: hidden;
  position: relative;
  display: flex;
  flex-wrap: none wrap;
  .wrapper-box {
    padding-bottom: 10px;
    background: #F2F2F6;
    border-radius: 6px;
    font-size: 12px;
    .list-item-box-left {
      overflow-y: auto;
      height: 95%;
      padding-bottom: 4px;
    }
    .list-item-box-right {
      margin-bottom: 4px;
    }
  }
}

.el-form .el-form-item {
  &.person-center-form-item {
    margin-bottom: 2px !important;
    color: #172161;
  }
}
.person-center-form-item {
  font-size: 12px;
  margin-left: 20px;
  .el-form-item__label, .el-form-item__content, .el-radio__label, .el-button, .el-checkbox .el-checkbox__label {
    font-size: 12px;
    color: #172161;
  }
  .el-input-number.is-without-controls.el-input__inner{
    width: 80px;
    height: 14px;
  }
  .el-input.el-input__inner{
    width: 80px;
    height: 10px;
  }
  .form-item-title{
    padding-left: 6px;
    padding-right: 6px;
    color: #666;
  }
  .el-divider--horizontal{
    margin: 8px 0;
    background: 0 0;
    border-top: 1px dashed #000000;
  }
}

  .bg-white-panel {
    padding: 5px;
    font-size: 14px;
    border-radius: 4px;
    margin-bottom: 5px;
  }
.receipt-nav-select {
  width: 420px;
  height: 40px;
  background-color: #F2F2F6;
  text-align: center;
  vertical-align: bottom;
  position: relative;
  margin: 10px 0 10px 60px;
}
.receipt-nav {
  overflow-y: auto;
  width: 420px;
  height: 620px;
  background-color: #ffffff;
  border-radius: 6px;
  position: relative;
  margin-left: 60px;
  padding-bottom: 10px;
}
.user-center-config {
  margin-top: 4px;
  margin-left: 140px;
  width: 480px;
  height: 620px;
  margin-bottom: 40px;
  overflow-y: auto;
  .user-center-content {
    .cardInfo {
        margin-top: -1px;
        margin-bottom: -1px;
        padding: 1px;
        height: 100%;
        background: #f2f2f6;
     }
    .panel-items {
      padding: 10px;
    }

    .panel-item {
      border: 1px solid #E3E2E5;
      margin-bottom: 5px;
      border-radius: 4px;
      color: #595961;

      .panel-header {
        padding: 0 10px;
        height: 39px;
        line-height: 39px;
        background-color: #F2F2F6;
        cursor: pointer;
        font-size: 12px;
      }
    }
  }
}

.nav-item {
  font-size: 12px;
  background: #fff;
  border: 1px solid #e3e2e5;
  border-radius: 4px;
  margin-bottom: 5px;
  width: 100%;
  display: inline-block;

  &:nth-child(odd) {
    margin-right: 5px;
    font-size: 12px;
    color: #595961;
  }

  .item-header {
    background: #efefef;
    border-radius: 4px 4px 0 0;
    height: 39px;
    line-height: 39px;
    padding: 0 5px 0 5px;
  }

  .item-content {
    padding: 3px 0;
  }
}
.receipt-info-title{
  position: relative;
  color: #ffffff;
  transition: all linear 30ms;
  box-sizing: border-box;
  padding: 0 4px;
  background-color: #fff;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  margin: 4px 6px 5px 6px;
  &.active {
    height: 180px;
    overflow: hidden;
  }

  .title-content {
    width: 100%;
    height: 100%;
    margin-top: 12px;
    text-align: center;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    border-radius: 4px;
    padding: 2px;
    .title-name {
      padding-top: 6px;
      vertical-align: top;
      color: #666;
      font-size: 16px;
      font-weight: bolder;
    }
  }
  .title-content-sub{
    width: 100%;
    height: 100%;
    margin-top: 2px;
    margin-bottom: 10px;
    text-align: center;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    border-radius: 4px;
    padding: 2px;
    .sub-title-name {
      padding-top: 6px;
      vertical-align: top;
      color: #666;
      font-size: 14px;
      font-weight: bolder;
    }
  }
}
.receipt-info-header {
  position: relative;
  color: #ffffff;
  transition: all linear 30ms;
  box-sizing: border-box;
  padding: 0 4px;
  background-color: #fff;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  margin: 4px 6px 5px 6px;
  &.active {
    height: 180px;
    overflow: hidden;
  }

  .header-content {
    width: 100%;
    height: 100%;
    margin-top: 8px;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    border-radius: 4px;
    padding: 2px;

  }

  .receipt-info {
    width: 100%;
    display:inline;

  }
.receipt-image-container {
  width: 100%;
  padding: 2px;
  border-radius: 4px;
  border: 0px solid #e3e2e5;
  text-align: center;
  margin: 1px 2px 1px 2px;
  position: relative;
  display: inline-flex;
  .receipt-image-shapecode {
    width: 320px;
    height: 90px;
    border: 0px solid #e3e2e5;
    margin: 1px auto;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center 0;
  }
  .receipt-image-qrcode {
    width: 10px;
    height: 10px;
    padding: 10px;
    border: 1px solid #e3e2e5;
    text-align: center;
  }
}

  .ehcart-pic {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-bottom: 2px;
  }

  .worker-photo {
    width: 10px;
    height: 10px;
  }

  .me-name {
    background: #534f4f;
    height: 20px;
    padding: 0 5px;
    border-radius: 20px;
  }

  .user-name {
    padding-top: 6px;
    vertical-align: top;
    color: #666;
    font-size: 14px;
    font-weight: bolder;
  }

  .user-code {
    margin-top: 15px;
    .icon-erweima{
      font-size: 25px;
    }
    .code-icon {
      font-size: 22px;
      margin-bottom: 3px;
    }
  }
}
.receipt-info-divider{
  margin: 5px 10px 5px 10px;
  max-height: 20px;
  .el-divider--horizontal{
    margin: 8px 0;
    background: 0 0;
    border-top: 1px dashed #000000;
  }
}
.receipt-info-footer{
  position: relative;
  text-align: center;
  color: #ffffff;
  transition: all linear 30ms;
  box-sizing: border-box;
  background-color: #fff;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: bottom;
  margin: 14px 6px 15px 6px;
  &.active {
    height: 220px;
    overflow: hidden;
  }
}
.receipt-content-container {
  width: 100%;
  padding: 2px;
  border-radius: 4px;
  border: 0px solid #e3e2e5;
  margin-bottom: 2px;
  position: relative;
  display: inline-flex;
}
.receipt-content{
  padding-right: 10px;
  color: #000000;
  .receipt-image-qrcode{
    width: 50px;
    height: 50px;
  }
}
.receipt-content-name{
  display: inline-block;
  padding: 1px 4px;
  font-size: 12px;
  text-align: center;
  margin-right: 5px;
}
.receipt-content-value{
  display: inline-block;
  padding: 1px 4px;
  font-size: 12px;
  text-align: center;
  margin-right: 5px;
}
.f1{
   padding-left: 40px;
}
.f2{
    padding-left: 60px;
}
.f3{
  float: right;
}
.receipt-content-hint {
  color: #38f;
  padding-top: 2px;
  margin-left: 10px;
  font-size: 8px;
}
</style>
